﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace GSync
{
    public class InternalAppointment : InternalEntry
    {
        public InternalAppointment()
        {
            Recurrence = new RecurrenceDescription();
        }
        public bool AllDayEvent { get; set; }
        public bool IsBusy { get; set; }
        public DateTime BeginDate { get; set; }
        public DateTime EndDate { get; set; }
        public string Subject { get; set; }
        public string Location { get; set; }
        public RecurrenceDescription Recurrence { get; set; }

        public override int GetHashCode()
        {
            long result = 0;
            result += GetHash(AllDayEvent);
            result += GetHash(BeginDate);
            result += GetHash(EndDate);
            result += GetHash(Subject);
            result += GetHash(Location);
            result += GetHash(this.Notes);
            result += GetHash(this.Recurrence.IsRecurrent);
            return Convert.ToInt32(result % int.MaxValue);
        }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(Subject);
            sb.AppendLine(Location);
            sb.AppendLine(BeginDate.ToString());
            sb.AppendLine(EndDate.ToString());
            sb.AppendLine(Notes);


            return sb.ToString();
        }
    }
}
